<?php
/**
 * JE Career package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
<form action="index.php" method="post" name="adminForm">
	<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'JE_FILTER' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'JE_CAREER_GO' ); ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'JE_FILTERRESET' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php
				echo $this->lists['state'];
				?>
			</td>
		</tr>
	</table>

	<table class="adminlist">
		<thead>
			<tr>
				<th width="1%">
					<?php echo JText::_( 'JE_SER_NO' ); ?>
				</th>
				<th width="2%">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
				</th>
				<th width="20%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',  JText::_( 'JE_POSITION' ), 's.position', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="15%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',  JText::_( 'JE_LOCATION' ), 's.location', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="10%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',  JText::_( 'JE_NO_OF_POSITION' ), 's.no_of_position', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="20%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',  JText::_( 'JE_DESCRIPTION' ), 's.discription', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="15%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',  JText::_( 'JE_CATEGORY' ), 'c.category', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="5%">
					<?php echo JHTML::_('grid.sort',   JText::_( 'JE_CAREER_PUBLISHED' ), 's.state', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="10%">
					<?php echo JHTML::_('grid.sort',  JText::_( 'ORDER' ), 's.ordering',$this->lists['order_Dir'], $this->lists['order']); ?>
					<?php echo JHTML::_('grid.order',  $this->items ); ?>
				</th>
				<th width="2%" nowrap="nowrap">
					<?php echo JHTML::_('grid.sort',   JText::_( 'JE_CAREER_ID' ), 's.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="10">
					<?php echo $this->pageNav->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
			<?php
			$k 					= 0;
			$numCategory 		= count($this->items);
			for ($i=0, $n=count( $this->items ); $i < $n; $i++){
				$row 			= &$this->items[$i];
				$checked 		= JHTML::_('grid.id',   $i, $row->id );
				$link 			= JRoute::_( 'index.php?option=com_hostingrajacareer&controller=career&task=edit&cid[]='. $row->id );
				$row->published = $row->state;
				$published		= JHTML::_('grid.published', $row, $i );

				// enable and disable for ordering field..
				$ordering 		= ($this->lists['order'] == 's.ordering');
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo $i+1; ?>
				</td>
				<td align="center">
					<?php echo $checked; ?>
				</td>
				<td align="center">
					<a href="<?php echo $link; ?>"><?php echo $row->position; ?></a>
				</td>
				<td align="center">
					<?php echo $row->location; ?>
				</td>
				<td align="center">
					<?php echo $row->no_of_position; ?>
				</td>
				<td align="center">
					<?php if(strlen($row->discription)>50){echo substr($row->discription,0,50)."...";}else{echo $row->discription;} ?>
				</td>
				<td align="center">
					<?php echo $row->category; ?>
				</td>
				<td align="center">
					<?php echo $published	; ?>
				</td>
				<td class="order">
					<!-- Oreder Up -->
					<span>
						<?php echo $this->pageNav->orderUpIcon($i, true, 'orderup', 'Move Up',isset($this->items[$i-1]) ); ?>
					</span>
					<span>
						<?php echo $this->pageNav->orderDownIcon($i, $numCategory, true, 'orderdown', 'Move Down',isset($this->items[$i+1]) ); ?>
					</span>
					<?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
					<!-- order text boxes -->
					<input type="text" name="order[]" size="4" value="<?php echo $row->ordering;?>"	class="text_area" style="text-align: center" <?php echo $disabled; ?> />
				</td>
				<td align="center">
					<?php echo $row->id; ?>
				</td>
			</tr>
				<?php
				$k = 1 - $k;
				}
				?>
		</tbody>
	</table>
	<input type="hidden" name="option" value="com_hostingrajacareer" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="controller" value="career" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
